package com.guiji.quartz.task;

import cn.wanghaomiao.xpath.exception.NoSuchAxisException;
import cn.wanghaomiao.xpath.exception.NoSuchFunctionException;
import cn.wanghaomiao.xpath.exception.XpathSyntaxErrorException;
import com.guiji.quartz.domain.SinaTotal;
import com.guiji.quartz.domain.SinaZongyi;
import com.guiji.quartz.domain.WangyiNews;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.model.ConsolePageModelPipeline;
import us.codecraft.webmagic.model.OOSpider;

/**
 * @program: cms-vue-plus
 * @description:
 * @author: gaoX
 * @create: 2021-09-13 19:17
 **/
@Component("sinaZongyiTask")
public class SinaZongyiTask {
	private static final Logger log = LoggerFactory.getLogger(SinaZongyiTask.class);
	public void sinaZongyiTask() {
		Long startTime = System.currentTimeMillis();
		Spider spider = OOSpider.create(Site.me().setSleepTime(1000), new ConsolePageModelPipeline(), SinaZongyi.class)
			.addUrl("https://ent.sina.com.cn/")
			.thread(20);
		spider.run();
		log.info("sinaZongyiTask-end-:{}",System.currentTimeMillis()-startTime);
	}
}
